package com.cskaoyan.bean.common;

import lombok.Data;

/**
 * @author stone
 * @date 2022/01/06 16:24
 */
@Data
public class BaseRespVo<T> {
    T data;
    String errmsg;
    int errno;

    public static <T> BaseRespVo ok(T data) {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setData(data);
        baseRespVo.setErrmsg("成功");
        return baseRespVo;
    }

    public static <T> BaseRespVo invalidData(String msg) {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(504);
        baseRespVo.setErrmsg(msg);
        return baseRespVo;
    }
    public static <T> BaseRespVo invalidData() {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(504);
        baseRespVo.setErrmsg("更新数据已失效");
        return baseRespVo;
    }
    public static <T> BaseRespVo invalidParameter(String msg) {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(400);
        baseRespVo.setErrmsg(msg);
        return baseRespVo;
    }
    public static <T> BaseRespVo unAuthc() {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(502);
        baseRespVo.setErrmsg("认证失败");
        return baseRespVo;
    }

    public static <T> BaseRespVo ok2(T data) {              //xd用来返回MarketSystem的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(data);
        return baseRespVo;
    }

    public static <T> BaseRespVo ok3() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        return baseRespVo;
    }

    //后台登录
    public static <T> BaseRespVo erron() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(605);
        baseRespVo.setErrmsg("用户帐号或密码不正确");
        return baseRespVo;
    }
    //前台登录
    public static <T> BaseRespVo erron1() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(700);
        baseRespVo.setErrmsg("用户帐号或密码不正确");
        return baseRespVo;
    }
    public static <T> BaseRespVo couponExchange2() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(600);
        baseRespVo.setErrmsg("领取数量达到上限");
        return baseRespVo;
    }
    public static <T> BaseRespVo couponExchange() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(601);
        baseRespVo.setErrmsg("兑换码不正确");
        return baseRespVo;
    }
    public static <T> BaseRespVo couponRecive1() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(801);
        baseRespVo.setErrmsg("注册即可获得");
        return baseRespVo;
    }
    public static <T> BaseRespVo couponRecive2() {                    //xd用来返回MarketSystemPost的Gson
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(802);
        baseRespVo.setErrmsg("通过兑换码兑换");
        return baseRespVo;
    }


    public static BaseRespVo couponRecive3() {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(803);
        baseRespVo.setErrmsg("优惠券领完了");
        return baseRespVo;
    }

    public static BaseRespVo couponRecive4() {
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(804);
        baseRespVo.setErrmsg("领券请先登录");
        return baseRespVo;
    }
}
